package com.example.flshtarvel.mapper;

import com.example.flshtarvel.entity.RouteCollectMap;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RouteCollectMapMapper {
    //路线收藏
    @Insert("insert into route_collect_map (route_id,user_id) values(#{routeId},#{userId})")
    public int routeCollect(String routeId, String userId);

    //取消收藏
    @Delete("delete from route_collect_map where route_id=#{routeId} and user_id=#{userId}")
    public int deleteRouteCollect(String routeId,String userId);

    //查询收藏    根据路线id 用户id
    @Select("select * from route_collect_map where route_id=#{routeId} and user_id=#{userId}")
    public List<RouteCollectMap> selectRouteCollectByRouteIdAndUserId(String routeId, String userId);

    //查询收藏数   根据路线id
    @Select("select count(*) from route_collect_map where route_id=#{routeId}")
    public int selectRouteCollectByRouteId(String routeId);
}
